<?php

class IfTag extends SmEngine implements ISmEngine
{
    protected  $_Open = 'if';
    protected  $_Close = TRUE;

    function render()
    {
        # compile elseif tag
        $this->_content = preg_replace('#{elseif (.*?)}#', "<?php elseif ($1): ?>", $this->_content);

        $this->_content = str_replace('{else}', '<?php else: ?>', $this->_content);

        return "<?php if ($this->_tag): ?>" .
            $this->_content .
            "<?php endif; ?>";
    }
}